package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.CustomerFund;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;

/**
 * Created by zhangjh 2016/9/30.
 */
@Repository
public interface CustomerFundRepository extends JpaRepository<CustomerFund, Long>, JpaSpecificationExecutor, CustomerFundRepositoryCustom {

    CustomerFund findByCustomerIdAndIsDelete(Long id, Whether isDelete);

    CustomerFund findByCustomerId(Long customerId);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    CustomerFund findOne(Long id);
}
